package com.moji.task;

import com.moji.service.MjWorkOrderService;
import com.moji.util.DateUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

@Component
public class CompleteWorkTask {

    @Resource
    private MjWorkOrderService workOrderService;

    @Scheduled(cron = "0 0/1 * * * ?")
    public void executeTask() {

        System.out.println("工单完结定时任务开始执行======= " + DateUtils.formatDate(new Date(),DateUtils.DATETIME_PATTERN));
        workOrderService.completeWork();
        System.out.println("工单完结定时任务执行结束======= " + DateUtils.formatDate(new Date(),DateUtils.DATETIME_PATTERN));

    }
}
